package com.aop.springaop.aspectj;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by SliverZhang on 2018/1/14.
 */
@Aspect
@Component
public class LoginAspect {

    @Before(value = "@annotation(com.aop.springaop.aspectj.Login)")
    public void getName(JoinPoint joinPoint){

        System.out.println("before login");
        System.out.println("方法簽名："+joinPoint.getSignature()+"參數值："+joinPoint.getArgs()[0]);
    }

    @After("within(com.aop.springaop.aspectj.LoginService)")
    public void getAge(JoinPoint joinPoint){
        System.out.println("after login");
        System.out.println("方法簽名："+joinPoint.getSignature()+"參數值："+joinPoint.getArgs()[0]);
    }




}
